import requests
class TInfluxDB:
    def __init__(self) -> None:
        self.host="meeting.xmgkfw.com"
        self.port = 42036
        self.token  = "Basic cm9vdDpoaHVjMTExNQ=="
        self.db = "pcs2023"
    def writeDatapoints(self , dataPoints ):
        try:
            headers = {
                "Authorization" : self.token,
                'Content-Type': 'application/json',
            }
            influxdb_url= "http://"+self.host+":"+str(self.port) + '/write?db='+self.db+'&rp=rePolicy_1h'
            resp = requests.post(url=influxdb_url , headers=headers , data=dataPoints)
            print(resp)
        except Exception as er:
            print(er)
